public class of21 {
    public static void main(String[] args) {
        
    }
    static void swap(int[] a,int i,int j){
        a[i]=a[i]^a[j];
        a[j]= a[i]^a[j];
        a[i]=a[i]^a[j];
    }
    public int[] exchange(int[] nums) {
        int left = 0;
        int right = nums.length-1;
        while(left<right){
             do left++;while(nums[left]%2==1);
             do right--;while(nums[right]%2==0);
             if(left<right){
                swap(nums, left, right);
             }
        }
        return nums;
    }
}
